# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Contributor: Daniel Isaksen <d@duniel.no>
# Contributor: Mickaël Schoentgen <mickael@apible.io>
# Contributor: fossdd <fossdd@pwned.life>
# Maintainer: fossdd <fossdd@pwned.life>
pkgname=httpie
pkgver=3.2.4
pkgrel=0
pkgdesc="CLI, cURL-like tool"
url="https://httpie.org/"
arch="noarch"
license="BSD-3-Clause"
depends="
	py3-defusedxml
	py3-multidict
	py3-pip
	py3-pygments
	py3-pysocks
	py3-requests
	py3-requests-toolbelt
	py3-rich
	py3-setuptools
	py3-wheel
	python3
	"
makedepends="
	py3-gpep517
	py3-wheel
	"
checkdepends="
	py3-pytest
	py3-pytest-httpbin
	py3-pytest-mock
	py3-responses
	py3-virtualenv
	py3-werkzeug
	"
source="https://files.pythonhosted.org/packages/source/h/httpie/httpie-$pkgver.tar.gz"
subpackages="$pkgname-doc $pkgname-pyc"
options="!check" # fail on random network errors

# secfixes:
#   3.2.3-r0:
#     - CVE-2023-48052
#   1.0.3-r0:
#     - CVE-2019-10751

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --system-site-packages --without-pip --clear testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest ./httpie ./tests -k "not TestQuietFlag and not test_fetch and not check_updates"
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
678ac9024a45f912ad19f10b1d609b19c630ef5d20886a7db0aa6bd71eb62cb91a8c9d5cf0060fac2bc457d9d95c6a2b80a556f6ac3176bc66064d81f45b0397  httpie-3.2.4.tar.gz
"
